package com.tedu.cotroller;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author CCFu
 * @version 1.0
 * @date 2021/12/15 14:19
 */
 @WebServlet//浏览器的默认访问规则与类名保持一致   /HServlet

//@WebServlet("/HServlet1")
public class HServlet1 extends HttpServlet {
     //Servlet的生命周期:三个阶段init()  destroy()   service()
    @Override
    public void init() throws ServletException {
        System.out.println("init()初始化...");
    }

    //会执行多次，访问几次servlet这个service()就会执行几次
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("service()开始服务...");
    }
    @Override
    public void destroy() {
        System.out.println("destroy()开始销毁...");
    }
}
